package com.itgungnir.designpattern.observer.custom;

public class Test {
	public static void main(String[] args) {
		// 创建主题（被观察者）
		Subject office = new NewsOffice();
		// 创建观察者
		Observer person1 = new Person1();
		Observer person2 = new Person2();
		Observer company1 = new Compony1();
		// 为观察者注册主题
		office.addObserver(person1);
		office.addObserver(person2);
		office.addObserver(company1);

		// 主题发送消息
		office.setThing("第一条新闻");
		System.out.println();
		office.setThing("哈哈哈哈哈哈哈哈哈哈");
	}
}